<template>
	<view class="mycontent_">
		<view class="mycontent_header">
			<view class="mycontent_headerTop" @click="goSetting">
				<image class="mycontent_headerImg" :src="userObj.avatar == '' ? 'https://z3.ax1x.com/2021/09/17/4Mlhex.png' : userObj.avatar"></image>
				<image class="mycontent_headerIcon" src="https://s4.ax1x.com/2022/01/27/7Ozq9f.png"></image>
			</view>
			<view class="mycontent_headerBottom">
				<view class="mycontent_headerBottomLeft">
					<p class="mycontent_headerName">{{userObj.nickname == "" ? '立即登录' : userObj.nickname}}</p>
					<view class="mycontent_headerPosition">
						{{userObj.company ? userObj.company : '虚位以待'}} {{userObj.post ? userObj.post : '虚位以待'}}
					</view>
					<view class="mycontent_headerBeanBox">
						<p class="mycontent_headerBeanBoxp" @click="goMyFans(0)">
							<span class="mycontent_headerBeanBoxpItem">{{userObj.follow}}</span>
							<span>关注</span>
						</p>
						<p class="mycontent_headerBeanBoxp" @click="goMyFans(1)">
							<span class="mycontent_headerBeanBoxpItem">{{userObj.fans}}</span>
							<span>粉丝</span>
						</p>
					</view>
				</view>
				<view class="mycontent_headerBottomRight" @click="goCalendar">
					<view class="mycontent_headerBottomRightBox">
						<image src="https://s4.ax1x.com/2022/01/27/7OzR1O.png"></image>
						<span class="mycontent_headerBottomRed">{{userObj.amianCoin}}</span>
						<span class="mycontent_headerBottomBlock">现有面值</span>
					</view>
					<view class="mycontent_headerBottomRightBox">
						<image src="https://s4.ax1x.com/2022/01/27/7OzIHA.png"></image>
						<span class="mycontent_headerBottomRduo">{{userObj.allAmianCoin == null ? 0 : userObj.allAmianCoin}}</span>
						<span>累计面值</span>
					</view>
				</view>
			</view>
		</view>
		<view class="mycontent_relevant">
			<view class="relevant_operation">
				<view class="relevant_operationItem" v-for="(newItem,newIndex) in userObj.badgeList" :key="newIndex">
					<view v-if="(!isPath &&  newItem.num != 0) || isPath" @click="ff_isPopup(newItem)">
						<image class="relevant_operationItemImg" :src="newItem.badgeImage"></image>
						<view class="relevant_operationItembox">
							<span class="mycontent_headerBottomRed">{{newItem.num}}</span>
							<span>{{newItem.badgeName}}/次</span>
						</view>
					</view>
				</view>
			</view>
		</view>


	</view>

</template>

<script>
	export default {
		data() {
			return {
				title: 'callingcard',

			}
		},
		props: {
			isPath: {
				type: Boolean,
				default: false
			},
			userObj: {
				type: Object
			},

		},
		onLoad(params) {},
		mounted() {
			// console.log("userObj--->",this.userObj)
		},
		methods: {
			goMyFans(index) {
				// this.isPopup = false
				this.$emit("goMyFans", index)
			},
			ff_chacha() {
				// this.isPopup = false
				this.$emit("ff_ispsp")
			},
			ff_isPopup(data) {
				// debugger
				let popObj = {};
				popObj.url = data.badgeImage;
				popObj.title = data.badgeName;
				popObj.text = data.title;
				popObj.num = data.num
				this.$emit("ff_isPopup", popObj);
			},
			goCalendar() {
				this.$emit("updataShow", Number(uni.getStorageSync('registerToast')))
				// Number(uni.getStorageSync('registerToast'));
				console.log("Number(uni.getStorageSync('registerToast')) == 2--->", Number(uni.getStorageSync(
					'registerToast')), 2)
				if (Number(uni.getStorageSync('registerToast')) == 2) {
					if (this.isPath) {

						this.$emit('goCalendarPath')
					}
				}
				// debugger

				// if(this.isPath){
				// 	debugger

				// }
			},
			goSetting() {
				this.$emit("updataShow", Number(uni.getStorageSync('registerToast')))
				// Number(uni.getStorageSync('registerToast'));
				console.log("Number(uni.getStorageSync('registerToast')) == 2--->", Number(uni.getStorageSync(
					'registerToast')), 2)
				if (Number(uni.getStorageSync('registerToast')) == 2) {
					if (this.isPath) {
						// debugger
						uni.navigateTo({
							url: "/pages/my/setting/setting"
						})
					}
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.mycontent_ {
		width: 100%;
		// padding: 0 32rpx;
	}

	.mycontent_headerTop {
		width: 100%;
		height: 120rpx;
		display: flex;
		justify-content: space-between;
	}

	.mycontent_header {

		width: 100%;
	}

	.mycontent_headerImg {
		width: 168rpx;
		height: 168rpx;
		border: 5rpx solid #fff;
		border-radius: 50%;
		position: relative;
		top: -56rpx;
	}

	.mycontent_headerIcon {
		width: 64rpx;
		height: 64rpx;
	}

	.mycontent_headerBottom {
		width: 100%;
		display: flex;
		justify-content: space-between;
		// padding: 0 32rpx;

		.mycontent_headerBottomLeft {
			width: 50%;
			flex: 1;
		}

		.mycontent_headerBottomRight {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: space-evenly;

			image {
				width: 48rpx;
				height: 48rpx;
			}
		}
	}

	.mycontent_headerBottomRed {
		color: #C4292B;
		overflow: hidden;
		flex: 0 0 143rpx;
		width: 143rpx;
		text-overflow: ellipsis; //文本溢出显示省略号
		white-space: nowrap; //文本不会换行
		text-align: center;
	}

	.mycontent_headerBottomRduo {
		overflow: hidden;
		flex: 0 0 143rpx;
		width: 143rpx;
		text-overflow: ellipsis; //文本溢出显示省略号
		white-space: nowrap; //文本不会换行
		text-align: center;
	}

	.mycontent_headerBottomBlock {
		color: #000;
	}

	.mycontent_headerBottomRightBox {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 75rpx;
		line-height: 75rpx;
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: 600;
		color: #83898D;
	}

	.mycontent_headerBottomRightBox:nth-child(1) {
		border-bottom: 3rpx solid #c9cac7;
	}

	.mycontent_headerName {
		height: 60rpx;
		font-size: 44rpx;
		font-family: PingFang SC;
		font-weight: 600;
		line-height: 60rpx;
		color: #020604;
		overflow: hidden;
		text-overflow: ellipsis; //文本溢出显示省略号
		white-space: nowrap; //文本不会换行
	}

	.mycontent_headerPosition {
		height: 34rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 34rpx;
		color: #83898D;
		margin: 8rpx 0;
		overflow: hidden;
		text-overflow: ellipsis; //文本溢出显示省略号
		white-space: nowrap; //文本不会换行
	}

	.mycontent_headerBeanBox {
		display: flex;
		justify-content: space-between;
		width: 75%;

		span {
			display: inline-block;
			color: #83898D;
			font-size: 24rpx;
		}

		.mycontent_headerBeanBoxpItem {
			color: #000;
			font-family: PingFang SC;
			font-weight: 600;
			color: #020604;
			margin-right: 5rpx;
		}
	}

	// <view class="relevant_operation">
	// 				<view class="relevant_operationItem" 
	// 					v-for="(newItem,newIndex) in userObj.badgeList" :key="newIndex">
	// 					<view v-if="(!isPath &&  newItem.num != 0) || isPath" @click="ff_isPopup(newItem)">
	// 						<image class="relevant_operationItemImg"  :src="newItem.badgeImage"></image>
	// 						<view class="relevant_operationItembox">
	// 							<span class="mycontent_headerBottomRed">{{newItem.num}}</span>
	// 							<span>{{newItem.badgeName}}/次</span>
	// 						</view>
	// 					</view>
	// 				</view>
	// 			</view>
	.relevant_operation {
		margin: 16rpx 0;
		margin-top: 24rpx;
		background-color: #eae8e5;
		padding: 24rpx 0;
		border-radius: 16rpx;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	
	image {
			width: 80rpx;
			height: 80rpx;

		}

		.relevant_operationItem {
			margin: 0 43rpx;
		}

		.relevant_operationItemImg {
			width: 80rpx;
			height: 80rpx;
		}

		.relevant_operationItembox {
			height: 28rpx;
			line-height: 28rpx;
			position: relative;
			top: -10rpx;
			text-align: center;

			.mycontent_headerBottomRed {
				font-size: 20rpx;
				font-family: PingFang SC;
				font-weight: 600;
			}

			span:nth-child(2) {
				font-size: 12rpx;
				font-family: PingFang SC;
				font-weight: 600;
				color: #020604;
			}
		}
	}
</style>
